// SceneObject.cpp: implementation of the SceneObject class.
//
//////////////////////////////////////////////////////////////////////

#include <iostream>
#include "SceneObject.h"
#include <iterator>

using namespace std;
SceneObject::SceneObject()  {}

SceneObject::~SceneObject() {}

void SceneObject::addChild(SceneObject *child)
{
	if (!child) { std::cerr << "Attempt to add invalid child to scene graph."; }
	
	child->setParent(this);
	childrenObjects.push_back(child);
}
void SceneObject::dropChild(SceneObject *child)
{
	if (!child) { std::cerr << "Attempt to add invalid child to scene graph."; }
	
    vector<SceneObject*>::iterator it;
 
    int i=0;    
    for (it=childrenObjects.begin() ; it!=childrenObjects.end(); ++it){
      i++;
      if (*it == child){
	     cout << "child erased" << *it<<endl;
	     childrenObjects.erase(childrenObjects.begin()+i-1);
	     //rotate(vec->begin(),vec->begin()+i-1,vec->end());
      }
      else
	      cout<<"no"<<i<<endl;
    }	    
}
